﻿using MySqlConnector;
using SqlSharp.Infrastructure;

namespace SqlSharp.Databases;

public abstract class DatabaseProvider
{
    public abstract Database Open();

    public static Database Open(Configuration configuration)
    {
        if (configuration.DatabaseType != "mysql") throw new NotSupportedException();
        var connection = new MySqlConnection(configuration.ConnectionString);
        return new MySqlDatabaseProvider(connection).Open();
    }
}